<%@ page import="java.util.Date,java.text.*"%>
<%@ page contentType="text/html;charset=UTF-8" language="java" %>


<%
    Date nowDay = new Date();
    int hour = nowDay.getHours();
    SimpleDateFormat format = new SimpleDateFormat("yyyy-MM-dd HH:mm:ss");
    String time = format.format(nowDay);

%>

<html>
<head>
    <title>第二个JSP应用</title>
</head>
<body>
<center>
    <table width="300" border="1">
        <tr height = "30">
            <td align= "center">温馨提示!</td>
        </tr>
        <tr height="80">
            <td align="center">现在时间为:<%=time%></td>
        </tr>
        <tr height ="70">
            <td align="center">
                <%
                    if(hour >= 24 && hour < 5)
                        out.print("现在是凌晨!时间还很早,再睡会吧!");
                    else if (hour >= 5 && hour < 10)
                        out.print("早上好!新的一天即将开始,您准备好了吗?");
                    else if (hour >= 10 && hour < 13)
                        out.print ("午休时间!正午好时光!");
                    else if (hour >= 13 && hour <18)
                        out.print("下午继续努力工作吧!");
                    else if (hour >= 18 && hour < 21)
                        out.print("晚上好!自由时间!");
                    else if (hour >= 21 && hour < 24)
                        out.print("已经是深夜,注意休息!");
                %>
            </td>
        </tr>
    </table>
</center>


</body>
</html>

